// ---------------------------------------------------------------------------------------------------------------------------------------------------------------
// dataRouterData
import {LocModel} from "../apiModel/base/LocModel";

export interface IDData {
    id: string;
}

export interface IconData {
    iconPath: string;
    Art: string;
}
export interface FamilyMember {
    id: string;
    family_tpye: string;
    family_level: number;
}
export interface TestData {
    id: string;
    skills: string;
    items: string;
    achs: string;
    admin: string;
    blackList: string;
}

export class AttrInterface {
    attrId: string
}


export class AttrData implements IDData {
    id: string;
    bAll: number;
    // 力量
    strength;
    // 敏捷
    agile;
    // 智力
    intellect;
    // 生命值
    life;
    // 最大生命值
    maxLife;
    // 生命回复速度
    lifeRecovery;
    // 魔法值
    magic;
    // 最大魔法值
    maxMagic;
    // 魔法恢复速度
    magicRecovery;
    // 护甲
    defense;
    // 攻击力
    attack;
    // 攻击速度
    attackSpeed;
    // 攻击范围
    attackRange;
    // 物理暴击伤害
    CH_physics_hurt;
    // 物理暴击率
    CH_physics_chance;
    // 物理加成
    physicsAddRadix;
    // 法术暴击伤害
    CH_spell_hurt;
    // 法术暴击率
    CH_spell_chance;
    // 法术加成
    spellAddRadix;
    // 输出
    hurt;
    // 移动速度
    speed;
    // 伤害减免
    damage_reduction;
    // 吸血
    blood_sucking;
    // 幸运值
    luckyValue;
    // 金币
    coin;
    // 金币加成
    coinAddRadix;
    // 木头
    wood;
    // 木头加成
    woodAddRadix;
    // 经验
    atlas_exp;
    // 经验加成
    expAddRadix;
    // 命中率
    hit;
    // 闪避率
    Dodge;

    attackDistance;

    size;

    coolingReduction;

    mainAttr;
}

export interface UnitPoolData extends IDData {
    type: number;
    talent: string;
    enable?: boolean;
    map_level: number;
    buy: number;
    achs: string;
    difficult: number;
    lockDes: string;
}
export enum TimeRewardType {
    default = 1,
    mall,
}
export enum TimeRewardTriggerType {
    default = 1,
    newSave,
    day,
}
export interface TimeRewardData extends IDData {
    condition: string,
    type: TimeRewardType,
    triggerType: TimeRewardTriggerType,
    checkPlayer: number,
    reward: string,
    init_time: number,
    interval_time: number,
}

export enum DifficultMode {
    pve = 1,
    pvp,
    free,
    mode4,
}

export enum GameWinType {
    onlyMe = 1,
}

export enum GameLoseType {
    noHero = 1,
    moreMonster,
}

export interface UIConfig {
    UI_path: string;
    UI_x: number;
    UI_y: number;
    UI_h: number;
    UI_w: number;
}

export interface DifficultData extends IDData, UIConfig {
    attackRadix: number;
    lifeRadix: number;
    defenseRadix: number;
    wave: number;
    front: number;
    affix_group: string;
    affix_num: string | number;
    mode: DifficultMode;
    integral: number;
    freeExp: number;
    winType: string;
    loseType: string;

    autoCounterattack: number;
}

export class UnitData extends AttrInterface implements FamilyMember, IconData {
    id: string
    unit_type: UnitType;
    Art: string;
    Ubertip: string;
    file: string;
    Name: string;
    modelScale: number;
    reward: string;
    attacked: number;
    // 单位占用的人口
    fused: number;
    Primary: string;
    STRplus: number;
    AGIplus: number;
    INTplus: number;
    bountyplus: number;
    lumberbountyplus: number;
    expAddValue: number;

    abilList: string;
    Sellitems: string;

    castBarHeight: number;
    castBarScale: number;

    family_tpye: string;
    family_level: number;

    moveHeight: number;
    modelPath: string;
    iconPath: string;

    useAttr: number;
    disengagement: number;

    resumeBase: number;
    resumeRadix: number;

    resumeTime: number;

    damageTip: string;

    counterattack: number;

    shopReward: string;

    forbiddenArea: string;
    forbiddenMode: string;
    forbiddenText: string;

    playerNumAddRadixAttack: string;
    playerNumAddRadixLife: string;

    waveAttackStrengthen: number;
    waveLifeStrengthen: number;

    hatredRange: number;

    growthAttrId: string;

    personality: Personality;

    abilitys: string;

    lv: number;
}

export enum Personality {
    normal,
    active,
}
export enum UnitType {
    boss = 1,
    pet,
    hookRebound,
    hookPull,
    shareBoss,
}

export enum ItemType {
    ability = 1,
    task,
    trans,
    rewardBox,
    recordItem,
    uiChooseItemBox,
    build,
    equip,
    seller,
}

export class ItemData extends AttrInterface implements IDData, IconData {
    id: string;
    _parent: string;
    wear_level: number;
    quality: number;
    affix_group: string;
    affix_num: number;
    file: string;
    position: PositionType;

    usable: number;
    useInterval: number;
    powerup: number;

    stockStart: number;
    stockRegen: number;
    stockMax: number;
    stockInit: number;

    itemid: string;
    stackable: number;
    Name: string;
    Ubertip: string;
    Description: string;
    item_type: ItemType;
    type_id: string;
    type_num: number;
    getCondition: string;
    getSuccessTip: string;
    getFailedTip: string;
    condition: string;
    abilList: string;

    goldcost: number;
    lumbercost: number;
    integral: number;

    family_tpye: string;
    family_level: number;

    upSuccess: number;
    downSuccess: number;

    effects: string;

    successTip: string;
    failedTip: string;

    failedReturn: number;

    singleBuyNum: number;

    iconPath: string;

    save: number;
    Art: string;

    decoration: string;
    decorationScale: number;
}

export enum AttributeEnum {
    null,
    // 力量
    strength,
    // 敏捷
    agile,
    // 智力
    intellect,
    // 生命值
    life,
    // 最大生命值
    maxLife,
    // 生命回复速度
    lifeRecovery,
    // 魔法值
    magic,
    // 最大魔法值
    maxMagic,
    // 魔法恢复速度
    magicRecovery,
    // 护甲
    defense,
    // 攻击力
    attack,
    // 攻击速度
    attackSpeed,
    // 攻击范围
    attackRange,

    // 物理暴击伤害
    CH_physics_hurt,
    // 物理暴击率
    CH_physics_chance,
    // 物理加成
    physicsAddRadix,
    // 物理伤害减免 最终伤害减免  不受任何穿透影响
    physics_damage_reduction,
    // 物理吸血
    physics_blood_sucking,
    // 物理命中
    physics_hit,
    // 物理闪避
    physics_Dodge,

    // 法术暴击伤害
    CH_spell_hurt,
    // 法术暴击率
    CH_spell_chance,
    // 法术加成
    spellAddRadix,
    // 法术伤害减免 最终伤害减免  不受任何穿透影响
    spell_damage_reduction,
    // 法术吸血
    spell_blood_sucking,
    // 法术命中
    spell_hit,
    // 法术闪避
    spell_Dodge,

    // 移动速度
    speed,

    // 幸运值
    luckyValue,
    // 金币
    coin,
    // 金币加成
    coinAddRadix,
    // 木头
    wood,
    // 木头加成
    woodAddRadix,
    // 经验
    exp,
    // 经验加成
    expAddRadix,


    // 攻击距离
    attackDistance,
    // 体型
    size,
    // 冷却缩减
    coolingReduction,

    // 主属性
    mainAttr,

    // 物理穿透 只穿透抗性
    physics_Penetration,
    // 法术穿透 只穿透抗性
    spell_Penetration,

    // 物理反伤
    physics_Thorns,
    // 法术反伤
    spell_Thorns,

    // 召唤物最大生命百分比
    summonLifePercent,
    // 召唤物攻击力百分比
    summonAttackPercent,
    // 召唤物攻击速度
    summonAttackSpeed,
    // 捕捉概率补偿
    catchRadix,

    // 百分比增幅主属性
    mainAttrP,
    // 力量百分比
    strP,
    // 敏捷百分比
    agiP,
    // 智力百分比
    intP,
    // 溅射伤害
    attackRangeHurt,
    // 技能效果增强
    abilityBonus,
    // 法强
    law,
    // 真实伤害
    realHurt,
    // 百分比真实伤害
    realHurtP,
    // 百分比攻击力
    attackP,
    // 百分比法强
    lawP,
    // 攻击间隔
    attackSpeedInterval,
    // 总伤害加成
    allAddRadix,
    // boss伤害加成
    bossAddRadix,
    // 小怪伤害加成
    monsterAddRadix,
    // 魔法抗性
    magicResistance,
    // 百分比最大生命值
    maxLifeP,
    // 百分比最大魔法值
    maxMagicP,
    // 百分比物理防御
    defenseP,
    // 百分比魔法抗性
    magicResistanceP,
    // 百分比生命恢复
    lifeRecoveryP,
    // 总伤害免疫
    allDamageReduction,
    // 物理暴击抵抗
    CH_physics_Resistance,
    // 魔法暴击抵抗
    CH_spell_Resistance,
    // 技能触发几率
    skillProbability,
    // 百分比魔法恢复
    magicRecoveryP,
    // 物理格挡
    physicsDamageBlock,
    // 魔法格挡
    spellDamageBlock,
    // 物理精准
    physicsPrecise,
    // 魔法精准
    spellPrecise,
    // 控制抗性
    controlResistance,
    // 百分比生命恢复
    lifeRecoveryMaxP,
    // 百分比魔法恢复
    magicRecoveryMaxP,
    // 每秒攻击力
    attackInterval,
    // 每秒力量
    strInterval,
    // 每秒敏捷
    agiInterval,
    // 每秒智力
    intInterval,
    // 每秒金币
    coinInterval,
    // 每秒木材
    woodInterval,
    // 每秒最大生命值
    maxLifeInterval,
    // 每秒最大魔法值
    maxMagicInterval,
    // 固定物理减免
    regular_physics_damage_reduction,
    // 固定魔法减免
    regular_spell_damage_reduction,
    // 固定物理穿透
    regular_physics_Penetration,
    // 固定魔法穿透
    regular_spell_Penetration,
    // 溅射角度
    attackRangeAngle,
    // 治疗加成
    treatAddRadix,
    // 治疗暴击
    CH_treat_hurt,
    // 治疗暴击几率
    CH_treat_chance,
    // 治疗抗性（重伤）
    treatResistance,
    // 治疗穿透
    treatPenetration,
    // 治疗减免
    treat_damage_reduction,
    // 全能暴击
    al_chHurt,
    // 全能爆伤
    al_chChance,
    // 全能伤害加成
    al_hurtAddRadix,
    // 全能吸血
    al_blood_sucking,
    // 全能命中
    al_hit,
    // 全能固定穿透
    al_regular_Penetration,
    // 全能百分比穿透
    al_penetration,
    // 全能精准
    al_precise,
    // 全能闪避
    al_dodge,
    // 全能格挡
    al_damageBlock,
    // 全能暴击抵抗
    al_chResistance,
    // 全能反伤
    al_thorns,
    // 全能固定伤害减免
    al_regularDamageReduction,
    // 全能百分比伤害减免
    al_damageReduction,

}
export interface AttrStrMap {
    key: number,
    str: string,
    usePercent: boolean,
    marginT?: number,
}

export class UnitAttribute {
    // 力量
    [AttributeEnum.strength]: number = 0;
    // 敏捷
    [AttributeEnum.agile]: number = 0;
    // 智力
    [AttributeEnum.intellect]: number = 0;
    // 生命值
    [AttributeEnum.life]: number = 0;
    // 生命值
    [AttributeEnum.maxLife]: number = 0;
    // 生命回复速度
    [AttributeEnum.lifeRecovery]: number = 0;
    // 魔法值
    [AttributeEnum.magic]: number = 0;
    // 魔法值
    [AttributeEnum.maxMagic]: number = 0;
    // 魔法恢复速度
    [AttributeEnum.magicRecovery]: number = 0;
    // 护甲
    [AttributeEnum.defense]: number = 0;
    // 攻击力
    [AttributeEnum.attack]: number = 0;
    // 攻击速度
    [AttributeEnum.attackSpeed]: number = 0;
    // 攻击范围
    [AttributeEnum.attackRange]: number = 0;
    // ----------------------------------------------------------------------------------------------------------------------

    // 物理暴击伤害增益
    [AttributeEnum.CH_physics_hurt]: number = 0;
    // 物理暴击几率
    [AttributeEnum.CH_physics_chance]: number = 0;
    // 物理加成
    [AttributeEnum.physicsAddRadix]: number = 0;
    // 物理伤害减免
    [AttributeEnum.physics_damage_reduction]: number = 0;
    // 物理吸血
    [AttributeEnum.physics_blood_sucking]: number = 0;
    // 物理命中
    [AttributeEnum.physics_hit]: number = 0;
    // 物理闪避
    [AttributeEnum.physics_Dodge]: number = 0;

    // 法术暴击伤害增益
    [AttributeEnum.CH_spell_hurt]: number = 0;
    // 法术暴击几率
    [AttributeEnum.CH_spell_chance]: number = 0;
    // 法术加成
    [AttributeEnum.spellAddRadix]: number = 0;
    // 法术伤害减免
    [AttributeEnum.spell_damage_reduction]: number = 0;
    // 法术吸血
    [AttributeEnum.spell_blood_sucking]: number = 0;
    // 法术命中
    [AttributeEnum.spell_hit]: number = 0;
    // 法术闪避
    [AttributeEnum.spell_Dodge]: number = 0;

    // 技能效果加成
    // 移动速度
    [AttributeEnum.speed]: number = 0;

    // 装备所需
    // 经验
    [AttributeEnum.exp]: number = 0;
    // 经验加成
    [AttributeEnum.expAddRadix]: number = 0;
    // 攻击距离
    [AttributeEnum.attackDistance]: number = 0;

    // 体型
    [AttributeEnum.size]: number = 0;
    // 冷却缩减
    [AttributeEnum.coolingReduction]: number = 0;

    // 幸运值
    [AttributeEnum.luckyValue]: number = 0;

    [AttributeEnum.coin]: number = 0;

    [AttributeEnum.wood]: number = 0;

    // 金币加成
    [AttributeEnum.coinAddRadix]: number = 0;

    // 木头加成
    [AttributeEnum.woodAddRadix]: number = 0;


    // 攻击距离
    [AttributeEnum.attackDistance]: number = 0;
    // 体型大小
    [AttributeEnum.size]: number = 0;

    // 主属性
    [AttributeEnum.mainAttr]: number = 0;

    [AttributeEnum.physics_Penetration]: number = 0;
    [AttributeEnum.spell_Penetration]: number = 0;
    [AttributeEnum.physics_Thorns]: number = 0;
    [AttributeEnum.spell_Thorns]: number = 0;

    [AttributeEnum.mainAttrP]: number = 0;
    [AttributeEnum.strP]: number = 0;
    [AttributeEnum.agiP]: number = 0;
    [AttributeEnum.intP]: number = 0;
    [AttributeEnum.attackRangeHurt]: number = 0;
    [AttributeEnum.abilityBonus]: number = 0;
    [AttributeEnum.law]: number = 0;
    [AttributeEnum.realHurt]: number = 0;
    [AttributeEnum.realHurtP]: number = 0;
    [AttributeEnum.attackP]: number = 0;
    [AttributeEnum.lawP]: number = 0;
    [AttributeEnum.attackSpeedInterval]: number = 0;
    [AttributeEnum.allAddRadix]: number = 0;
    [AttributeEnum.bossAddRadix]: number = 0;
    [AttributeEnum.monsterAddRadix]: number = 0;
    [AttributeEnum.magicResistance]: number = 0;
    [AttributeEnum.maxLifeP]: number = 0;
    [AttributeEnum.maxMagicP]: number = 0;
    [AttributeEnum.defenseP]: number = 0;
    [AttributeEnum.magicResistanceP]: number = 0;
    [AttributeEnum.lifeRecoveryP]: number = 0;
    [AttributeEnum.allDamageReduction]: number = 0;
    [AttributeEnum.CH_physics_Resistance]: number = 0;
    [AttributeEnum.CH_spell_Resistance]: number = 0;
    [AttributeEnum.skillProbability]: number = 0;
    [AttributeEnum.magicRecoveryP]: number = 0;
    [AttributeEnum.physicsDamageBlock]: number = 0;
    [AttributeEnum.spellDamageBlock]: number = 0;
    [AttributeEnum.physicsPrecise]: number = 0;
    [AttributeEnum.spellPrecise]: number = 0;
    [AttributeEnum.controlResistance]: number = 0;

    [AttributeEnum.lifeRecoveryMaxP]: number = 0;
    [AttributeEnum.magicRecoveryMaxP]: number = 0;
    [AttributeEnum.attackInterval]: number = 0;
    [AttributeEnum.strInterval]: number = 0;
    [AttributeEnum.agiInterval]: number = 0;
    [AttributeEnum.intInterval]: number = 0;
    [AttributeEnum.coinInterval]: number = 0;
    [AttributeEnum.woodInterval]: number = 0;
    [AttributeEnum.maxLifeInterval]: number = 0;
    [AttributeEnum.maxMagicInterval]: number = 0;
    [AttributeEnum.regular_physics_damage_reduction]: number = 0;
    [AttributeEnum.regular_spell_damage_reduction]: number = 0;
    [AttributeEnum.regular_physics_Penetration]: number = 0;
    [AttributeEnum.regular_spell_Penetration]: number = 0;
    [AttributeEnum.attackRangeAngle]: number = 0;

    [AttributeEnum.treatAddRadix]: number = 0;
    [AttributeEnum.CH_treat_hurt]: number = 0;
    [AttributeEnum.CH_treat_chance]: number = 0;
    [AttributeEnum.treatPenetration]: number = 0;
    [AttributeEnum.treatResistance]: number = 0;
    [AttributeEnum.treat_damage_reduction]: number = 0;

    [AttributeEnum.al_chHurt]: number = 0;
    [AttributeEnum.al_chChance]: number = 0;
    [AttributeEnum.al_hurtAddRadix]: number = 0;
    [AttributeEnum.al_blood_sucking]: number = 0;
    [AttributeEnum.al_hit]: number = 0;
    [AttributeEnum.al_regular_Penetration]: number = 0;
    [AttributeEnum.al_penetration]: number = 0;
    [AttributeEnum.al_precise]: number = 0;
    [AttributeEnum.al_dodge]: number = 0;
    [AttributeEnum.al_damageBlock]: number = 0;
    [AttributeEnum.al_chResistance]: number = 0;
    [AttributeEnum.al_thorns]: number = 0;
    [AttributeEnum.al_regularDamageReduction]: number = 0;
    [AttributeEnum.al_damageReduction]: number = 0;


    [AttributeEnum.catchRadix]: number = 0;

    // 在一些情况下初始化这个类型的变量需要初始化其中的一些值，比如将一个新单位加入属性框架时
    constructor() {
    }
}

export class PlayerAttribute extends UnitAttribute {
}

export enum HurtType {
    // 物理
    physics = 1,
    // 魔法
    spell,
    // 普通攻击
    hero,
    // 治疗
    treat,
}

export enum RewardItemType {
    item = 1,
    trans,
    coin,
    exp,
    wood,
    changeHero,
    achievement,
    npc,
    enemy,
    unit,
    wave,
    resetUnit,
    initMonster,
    clearItem,
    skill,
    technology,
    populationMax,
    changeBox,
    changeHeroModel,
    task,
    toWin,
    toLose,
    removeSkill,
    pet,
    resumePet,
    maxMonsterNum,
    integral,
    qualityMix,
    backHome,
    transAll,
    music,
    invulnerable,
    whiteAttr,
    stopWave,
    removeItem,
    handBookExp,
    startLoc,
    talent,
    resumeHero,
    addSeller,
    removeSeller,
    learnSkillByFamilyLv,
    removeSkillByFamilyLv,
    removeAchievement,
}

export enum TriggerMethodType {
    // 主动使用
    activeUseTrigger = 1,
    // 按时循环触发
    intervalTrigger,
    // 攻击触发
    attackTrigger,
    // 被攻击触发
    attackedTrigger,
    // 出怪触发
    waveTrigger,
    // 升级触发
    levelUpTrigger,
    // 杀怪触发
    killTrigger,
    // 死亡触发
    deadTrigger,
    // 普攻暴击触发
    chTrigger,
    // 怪物的普攻被闪避时触发
    dodgeTrigger,
    // 所有主动技能都会触发
    activeAllTrigger,
}

export interface RewardItemData extends WeightIDData {
    group_Id: string;
    type: RewardItemType;
    itemId: string;
    number: number;
    weight: number;
    descript: string;
    condition: string;

    self_effects: string;
    self_effects_point: string;
    self_effects_time: number;
    self_effects_scale: number;

    point_effects: string;
    point_effects_time: number;
    point_effects_scale: number;

    bAll: number;


    // 掉落单位组几率，不从表中读取，在程序初始化时计算出来
    guard_time?: number;
    interval_time?: number;
}

export enum RewardGroupType {
    default = 0,
    playerOnlyOne,
    allOnlyOne,
    mallCumulative,
    useCumulative,
}

export interface RewardGroupData {
    rewardId: string;
    dataId: string;
    probability: number;
    type: RewardGroupType;

    num: number;
    guard_time: number;
    interval_time: number;
}

export interface WeightIDData extends IDData {
    weight?: number;
    probability?: number;
}

export interface TalentPoolData extends WeightIDData {
    achievementId: string;
    heroLevel: number;
    talentLimit: number;
    reward: string;
}

export interface TransData extends IDData, UIConfig {
    tp_start: string;
    tp_end: string;
    condition: string;

    music: string;
    musicInterval: number;
}
export enum AdminItemType {
    ach = 1,
    item,
    ability,
    other,
}

export enum HandBookType {
    hero = 1,
    wild,
    rare,
}
export interface HandBookData extends AttrInterface {
    id: string;
    no: number;
    type: HandBookType;
    family_tpye: string;
    desc: string;
    skill: string;
    atlas_exp: string;
    diffent_exp_victory: string;
    diffent_exp_fail: string;
    // effect: string;
    max_lv: number;
}

export interface PetData extends IDData {
    catch_id: string;
    catch_compensate: number;
    catch_life: string | number;
    catch_probability: string | number;
    get_pet: string | number;
    get_pet_weight: string | number;
    hatch_eggs: string;
    evolution: string;
    evolution_weight: string | number;
    evolution_condition: string;
}
export interface GenerateData extends IDData, UIConfig {
    type: GenerateDataType
    init_time: number;
    mode: DifficultMode;
    param: string | number;
    interval_time: number;
    monster_id: string;
    num: number;
    locType: LocType;
    area: string;
    face_angle: number
    text: string
    timerText: string;
    auto_resume: number;
    appear_probability: number;
    existence_time: number;
    tip: string;
    tipShowName: number;
    tip_display: number;
    path: string;

    difficult:  number;
    playerNum: number;
    checkPlayer: number;

    realLoc?: LocModel;
}
export interface MaterialData {
    id: string;
    material_id: string;
    material_num: string;
}
export class MixData implements MaterialData {
    reward: string;
    condition: string;

    id: string;
    material_id: string;
    material_num: string;
}
export enum CombinationType {
    good = 1,
    unit,
}
export class CombinationData extends AttrInterface implements MaterialData {
    id: string;
    name: string;
    desc: string;
    type: CombinationType;

    bAll: number;

    iconPath: string;

    material_id: string;
    material_num: string;

    add_skill: string;
    del_skill: string;

    effects: string;

}
export enum GenerateDataType {
    enemy = 1,
    text,
    item,
    toast,
    scan,
    timer,
    ui,
    teamEnemy,
}

export enum BossChoose {
    closest = 1,
    furthest,
    all,
    randomUnit,
    randomRange,
}

export enum TaskType {
    main = 1,
    deputy,
    circulate,
    forever,
    team,
}

export enum PathType {
    move = 1,
    attack,
}

export interface TaskData extends IDData {
    id_item: string;
    difficult: number;
    playerNum: number;
    save: SaveType;
    type: TaskType;

    clickTp: number;
    task_auto: number;
    tip_condition: number;
    start_auto: number;
    task_name: string;
    task_content: string;
    task_reward: string;
    task_get_content: string;
    condition: string;
    apply_reward_item: string;
    task_reward_item: string;
    catch_speech: string;
    pay_speech: string;
    tip_area: string;

    showCondition: number;
    time_limit: number;
    fail_reward_item: string;
}

export enum ConditionType {
    talk = 1,
    kill,
    gather,
    difficult,
    skillFamily,
    heroLevel,
    mallUse,
    mallBuy,
    mapLevel,
    paseDifficult,
    selfUnitType,
    onlyOneSave,
    onlyDayOne,
    hasItem,
    checkHasPet,
    checkHasAch,
    mallNum,
    wave,
    itemNumUse,
    rect,
    mode,
}
export enum EqualType {
    equal,
    greaterThan,
    lessThan,
}
export interface ConditionData extends IDData {
    conditionId: string;
    type: ConditionType;
    mode: DifficultMode;
    num: number;
    value: string;
    equalType: EqualType;
}

export enum LocType {
    center = 1,
    random,
}

export interface AttackMonsterData extends IDData {
    wave: number;
    monsterId: string;

    mode: DifficultMode;
    creamId: string;
    des: string;
    // 间隔
    interval: number;
    // 持续时间
    time: number
    // 刷新频率
    frequency: number;
    locType: LocType;
    birth_point: string;
    path: string;
    checkPlayer: number;

    bossId: string;
    boss_locType: LocType;
    boss_birth_point: string;
    boss_path: string;

    beforeReward: string;
    afterReward: string;
}

export interface PathData extends IDData {
    type: PathType,
    path: string,
    delay: number
}

export enum TalentType {
    default,
}

export enum AchievementType {
    achievement = 1,
    talent,
    hidden,
    saveItem,
    marketItem,
    difficult,
    mapLevel,
    activity,

    forging,
    engineering,
    alchemy,
    inscription,
    book,
}
export enum AchievementBeneficiaryType {
    hero = 1,
    pet,
    summon,
}

export enum PositionType {
    other,
    arms = 1,
    pad,
    clothes,
    hat,
    pants,
    shoe,
    belt,
    necklace,
    ring,
}

export enum TargetLocType {
    targetLoc,
    activeLoc,
}

export interface AbilityEffectData extends IDData {
    txt: string;

    addAbility: string;

    magic_effect: string,
    name: string,

    // 使用失败的文字提示
    fail_tips: string;
    // 使用成功的文字提示
    succeed_tips: string;
    // 范围
    range: number;
    // 范围技能时最大单位数
    max_unit: number;
    // 上限
    upper_limit: number;
    // 持续时间
    time_duration: number;
    // 冷却时间
    cool: number;
    // 延迟时间
    delay_time: number;
    // 回调效果
    effect_callback: string;
    // 回调效果权重
    callbackWeight: string;
    // 0是敌人 1是队友
    mine: number;
    // 触发条件
    triggerMethod: TriggerMethodType;
    // 触发几率
    probability: number;
    // 触发频率
    frequency: number;
    // 触发间隔（当是持续性技能时）
    interval: number;
    // 是否刷新触发点
    reflushLoc: number;
    // 使用触发单位点还是目标单位点获取范围
    targetLocType: TargetLocType;


    // 消耗
    consume: string;
    // 消耗值
    consumption_value: string;
    // 消耗使用百分比
    consumption_percentage: string;


    // 属性增益目标
    add_target: string;
    // 属性增益目标对象
    add_source_isMine: string;
    // 属性增益参照
    add: string;
    // 增益值
    add_value: string;
    // 增益使用百分比
    add_percentage: string;
    // 属性增益持续时间
    add_time: number;
    // 属性增益变身
    add_transformation: string;

    // // 属性增益单位
    // addunit: AttributeEnum;
    // // 增益单位值
    // addunit_value: number;
    // // 增益单位使用百分比
    // addunit_percentage: number;

    // 伤害
    harm: string;
    // 伤害目标属性
    harm_target_attribute: AttributeEnum;
    // 伤害目标对象
    harm_source_isMine: string;
    // 伤害值
    harm_value: string;
    // 伤害类型
    harm_type: HurtType;
    // 伤害是否使用百分比
    harm_percentage: string;

    summon_id: string;
    summon_num: number;
    // 召唤单位属性
    summon: string;
    // 召唤单位属性对照
    summon_correspond: string;
    // 召唤单位属性值
    summon_value: string;
    // 召唤单位是否使用百分比
    summon_percentage: string;
    // 召唤单位持续时间
    summon_unit_time: number;

    // 奖励
    theft: string;
    // 计算百分比奖励时的目标
    theft_target_attribute: string;
    // 奖励目标对象
    theft_target_isMine: string;
    // 奖励是否参照自己
    theft_source_isMine: string;
    // 奖励值
    theft_value: string;
    // 窃取使用百分比
    theft_percentage: string;

    effectsAlways: number;

    // 使用者技能效果特效
    self_effects: string;
    self_effects_time: number;
    self_effects_point: string;
    self_effects_scale: number;

    // 使用者点特效
    self_point_effects: string;
    self_point_effects_time: number;
    self_point_effects_scale: number;

    // 技能点效果特效
    point_effects: string;
    point_effects_time: number;
    point_effects_scale: number;

    // 召唤物效果特效
    summon_effects: string;
    summon_effects_time: number;
    summon_effects_scale: number;
    summon_follow: number;


    // 目标特效
    target_effects: string;
    // 目标特效时间
    target_effects_time: number;
    // 特效点
    target_effects_point: string;
    target_effects_scale: number;

    animation: string;
    // animationTime: number;

    // 马甲技能
    vest: string;

    reward: string;

    condition: string;
}

export interface BossData extends IDData {
    monster_id: string;
    wave: number;
    birth_point: string;
    path: string;
}

export class AbilityData implements FamilyMember, IconData {
    id: string;
    Name: string;
    skill_type: AbilityType;
    Ubertip: string;
    Art: string;
    txt: string;
    effects: string;
    _parent: string;
    key: string;
    Hotkey: string;
    Order: string;
    vest: string;
    Cool: number;
    family_tpye: string;
    family_level: number;
    reward: string;
    Requires: string;
    success_tip: string;
    cast_type1: CastType1;

    DataG: string;

    Rng: number;
    Area: number;
    Cost: number;
    Cast: number;
    // 通魔中dataA是持续施法时间
    DataA: number;

    UnitID: string;

    attrId: string;

    iconPath: string;

    requiredAchs: string;

    coolDown: number;
}

export enum AppearanceType {
    heroArm1 = 1,
    heroArm2,
    heroWing,
    heroRing,
    heroTitle,
    heroSkin,
    boxSkin,
}


export enum UnitShopType {
    normal = 1,
}

export enum IntegralMallType {
    normal = 1,
}

export class AppearanceData implements IDData {
    id: string;
    type: AppearanceType;
    self_effects: string;
    self_effects_scale: number;
    ach: string;
}

export class IntegralMallData implements IDData {
    id: string;
    integral: number;
    type: IntegralMallType;
    ach: string;
}

export enum ResourceType {
    model = 1,
    image,
    music,
}

export class ResourceData implements IDData {
    id: string;
    type: ResourceType;
    src: string;
}


export class AchievementData extends AttrInterface implements IDData, UIConfig {
    id: string;
    iconPath: string;
    name: string;
    descript: string;
    failed_tip: string;
    success_tip: string;
    save: SaveType;
    beneficiary: AchievementBeneficiaryType;
    technology: string;
    effects: string;
    maxNum: number;
    type: AchievementType;
    integral: number;
    hidden: number;

    UI_h: number;
    UI_path: string;
    UI_w: number;
    UI_x: number;
    UI_y: number;
}

export class AffixData extends AttrInterface implements IDData {
    id: string;
    group: string;
    weight: number;
    Name: string;
    Ubertip: string;
    effects: string;
    skill: string;

    // 掉落单位组几率，不从表中读取，在程序初始化时计算出来
    probability: number;
    condition: string;
}


export enum AbilityType {
    active,
    actived,
    goods,
}

export enum BossAICondition {
    attackedNum = 1,
    life_percentage,
    fightTime,
    attackNum,
    playerNum,
    life,
}

export interface AutocastDataData extends IDData {
    monster_id: string,
    tip: string,
    type: BossAIType,
    area: number,
    max_unit: number,
    condition: BossAICondition,
    delay: number,
    num: number,
    choose: BossChoose,
    target_effects: string,
    target_effects_point: string,
    target_effects_scale: string,

    self_effects: string,
    self_effects_point: string,
    self_effects_scale: string,

    point_effects_type: number,
    point_effects: string,
    point_effects_scale: string,

    sound_effect: string,

    skill_id: string
    probability: number,

    failure_effect: string,
    failure_tip: string,
}
export enum PointEffectsType {
    circle = 1,
    line,
}
export enum BossAIType {
    vest = 1,
    nomal,
}
export interface InputData extends IDData {
    reward: string,
    command: string,
    text: string,
    times: number,
}

export enum MallType {
    mallBuy,
    mapLevel,
}

export enum CastType1 {
    null,
    unit,
    point,
}
export enum CastType2 {
    default = 1,
    range,
}

export interface AbilityFamilyHotKey {
    def: string,
    Q: string,
    W: string,
    E: string,
    R: string,
    T: string,
    Y: string,
}

export enum SaveType {
    no,
    archive,
    global,
}